/**
showPopupWindow(400,300,"<font>asdfadsfasfsd<br/>asdfdsf</font>","pink","#fafafa","标题内容",true);
*/
var isJQPWED=false;
function closeShowPopupWindow()
{
	isJQPWED=false;
	var ele=document.getElementById("jqshowPopupWindow");
	if(ele)
	{
		ele.style.display="none";
		ele.innerHTML="";
		try
		{
			document.body.removeChild(ele);
		}catch(e){}
	}
}
function showPopupWindow(width,height,data,headColor,bgColor,title,isFrameScroll,gdTop)
{
	if(isJQPWED){return;}
	isJQPWED=true;
	if((headColor == undefined)||(headColor=="")){headColor="#efefef";}
	if((bgColor == undefined)||(bgColor=="") ){bgColor="white";}
	if((isFrameScroll == undefined)||(isFrameScroll=="") ){isFrameScroll=false;}
	if((title == undefined) ){title="";}
	
	var bodyWidth=$(document.body).width();
	var bodyHeight=$(document).height();
	var screenHeight=$(window).height();
	var scrollTop=$(document.body).scrollTop();
	
	var left=Math.floor((bodyWidth-width)/2);
	if((bodyHeight > screenHeight)&&(screenHeight > 100)){bodyHeight=screenHeight;}
	var top=Math.floor((bodyHeight-height)/2);

	if(top<0){top=0;}
	top=top+scrollTop;
	
	if(gdTop != undefined)
	{
		top=gdTop;
	}
	
	var div1=document.createElement("div");
	div1.id="jqshowPopupWindow";
	div1.style.display="none";
	document.body.appendChild(div1);
	div1=$(div1);
	div1.show();
	div1.css("zIndex",198910202); 
	div1.css("position","absolute");
	div1.css("left",left+"px");
	div1.css("top",top+"px"); 
	div1.css("width",width+"px"); 
	div1.css("height",height+"px"); 
	div1.css("background",bgColor); 
	div1.css("padding","2px"); 
	div1.css("-moz-border-radius","5px"); 
	div1.css("-webkit-border-radius","5px"); 
	div1.css("border-radius","5px"); 
	
	var div2=document.createElement("div");
	div2=$(div2);
	div1.append(div2);
	div2.css("border",headColor+" 2px solid"); 
	div2.css("height",(height-4)+"px"); 
	
	var headDiv=document.createElement("div");
	headDiv=$(headDiv);
	div2.append(headDiv);
	headDiv.css("background",headColor); 
	headDiv.css("padding-right","5px"); 
	headDiv.css("text-align","left"); 
	headDiv.css("height","23px");
	headDiv.attr("align","left"); 
	headDiv.html('<table cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td align="left"><font style="font-size:14px;font-family:微软雅黑;">'+title+'</font></td><td align="right"><a href="javascript:;" onclick="closeShowPopupWindow()" title="关闭" style="corsur:pointer;color:black;text-decoration:none;float:right" >x</a></td></tr></table>');
	
	var dataDiv=document.createElement("div");
	dataDiv=$(dataDiv);
	div2.append(dataDiv);
	dataDiv.css("border","0px");
	dataDiv.css("text-align","left");
	dataDiv.attr("align","left");
	
	var c1=data.substring(0,1);
	if(("/" == c1)||((data.length > 6)&&(("http:" ==data.substring(0,5))||("https:" ==data.substring(0,6))))) //是一个地址
	{
		var html="";
		var browserInfo=getBrowserInfo();
		var frameHieght=height,frameWidth=width;
		if("ie" == browserInfo.browser)
		{
			frameHieght=height-25;
			frameWidth=width-4;
		}else if("firefox" == browserInfo.browser)
		{
			frameHieght=height-30;
			frameWidth=width-5;
		}if("chrome" == browserInfo.browser)
		{
			frameHieght=height-27;
			frameWidth=width-4;
		}else
		{
			frameHieght=height-25;
			frameWidth=width-5;
		}
		if(isFrameScroll)
		{	
			html='<iframe src="'+data+'" width="'+frameWidth+'px" height="'+frameHieght+'px" frameborder="0" ></iframe>';
		}else
		{
			html='<iframe src="'+data+'" width="'+frameWidth+'px" height="'+frameHieght+'px" frameborder="0" scrolling="no" ></iframe>';
		}
		dataDiv.html(html);
	}else if((typeof(data) == "object"))// 是一个对象
	{
		dataDiv.html(data.innerHTML);
	}else if(document.getElementById(data)) // 是一个标签
	{
		dataDiv.html($("#"+data).html());
	}else // 是一个字符串
	{
		dataDiv.html(data);
	}
}

